<template>
  <el-dialog
    class="public-dialog"
    :title="dialogtitle"
    :modelValue="modelValue"
    @close="handleClose"
    draggable
    align-center
    width="400"
  >
    <div class="min-h-[300px] text-center">
      <template v-for="(i, idx) in list || []" :key="i">
        <div class="border-b border-gray-300 last:border-none py-[16px]">
          <div>
            <VText title="采购单号" :value="i?.purchase_number" />
          </div>
          <div>
            <VText title="供应商" :value="i?.purchase_supplier_name" />
          </div>
          <div>
            <VText title="下单方式" :value="i?.purchase_order_type" />
          </div>
          <div>
            <VText title="采购主体" :value="i?.purchase_subject_name" />
          </div>
          <div>
            <VText title="入库数量" :value="i?.purchase_sku_inbound_quantity" />
          </div>
          <div>
            <VText title="报关数量" :value="i?.purchase_quantity" />
          </div>
        </div>
      </template>
    </div>
  </el-dialog>
</template>

<script setup>
const modelValue = ref(false);
const list = ref([]);
const handleClose = async (refresh) => {
  list.value = [];
  modelValue.value = false;
};
const dialogtitle = ref("");
const open = ({ data, title }) => {
  console.log(title);
  modelValue.value = true;
  list.value = data;
  dialogtitle.value = title;
};
defineExpose({
  open,
});
</script>
